package org.blame.rabbitmqadvancedfeature.listener;


import org.blame.rabbitmqadvancedfeature.constant.Constants;
import org.springframework.amqp.core.Message;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;

import java.util.Date;

@Component
public class DelayListener {

//    @RabbitListener(queues = Constants.DEL_QUEUE2)
//    public void delayListener(Message message){
//        System.out.printf("[ %s: ], %tc:接收时间",new String(message.getBody()),new Date());
//        System.out.println("消息接收成功");
//    }

    @RabbitListener(queues = Constants.DELAY_QUEUE)
    public void delayListener2(Message message){
        System.out.printf("[ %s: ], %tc:接收时间",new String(message.getBody()),new Date());
        System.out.println("消息接收成功");
    }
}
